<?php

require 'orm/om/BaseStatePeer.php';


/**
 * Skeleton subclass for performing query and update operations on the 'state' table.
 *
 * 
 *
 * You should add additional methods to this class to meet the
 * application requirements.  This class will only be generated as
 * long as it does not already exist in the output directory.
 *
 * @package    orm
 */
class StatePeer extends BaseStatePeer {
public function getStates($countryId = 1){
		$criteria = new Criteria();

		$criteria->add(StatePeer::COUNTRY_ID, $countryId);

		$oStates = StatePeer::doSelect($criteria);

		foreach($oStates as $state){
			$aStates[$state->getId()] = $state->getName();
		}
		return $aStates;
	}

	public function getStateName($id){

		$oState = StatePeer::retrieveByPK($id);

		if($oState)
		{
			return $oState->getName();
		}else{
			return NULL;
		}
	}
} // StatePeer
